Ext.Loader.setConfig( {
	enabled : true
});

Ext.require( [ '*' ]);

Ext.onReady(function() {

		var kakakuPricePanel=Ext.create('Ext.form.Panel', {
			region : 'center',
			renderTo : 'bodyarea',
			frame : true,
			bodyStyle : 'padding:5px 5px 0',
			width : 750,
			fieldDefaults : {
				msgTarget : 'side',
				labelWidth : 90
			},
			defaultType : 'textfield',
			defaults : {
				anchor : '100%'
			},

			items : [  {
				xtype : 'fieldset',
				title: '情報',
				collapsible: true,
				combineErrors : true,
				msgTarget : 'side',
				layout : 'anchor',
		          defaults: {
	                anchor: '100%'
	            },
	            defaultType: 'textfield',
				items : [{
	                fieldLabel: 'メ発送待U64',
	                labelWidth:90,
	                labelSeparator:'：',
	                value:'https://order.rms.rakuten.co.jp/rms/mall/order/rb/vc?__event=BO01_001_001&status_id=55',
	                id: 'u64'
	                
	            },{
	                fieldLabel: 'メ発送待U32',
	                labelWidth:90,
	                labelSeparator:'：',
	                value:'https://order.rms.rakuten.co.jp/rms/mall/order/rb/vc?__event=BO01_001_001&status_id=56',
	                id: 'u32'
	            },{
	                fieldLabel: 'メ発送待P64',
	                labelWidth:90,
	                labelSeparator:'：',
	                value:'https://order.rms.rakuten.co.jp/rms/mall/order/rb/vc?__event=BO01_001_001&status_id=57',
	                id: 'p64'
	            },{
	                fieldLabel: 'メ発送待P32',
	                value:'https://order.rms.rakuten.co.jp/rms/mall/order/rb/vc?__event=BO01_001_001&status_id=58',
	                labelWidth:90,
	                labelSeparator:'：',
	                id: 'p32'
	            }, {
	                xtype: 'button',
	                text : 'ヤマトメール便CSVファイルダウンロード',
	                margin : '0 0 10px 0',
	                handler: function() {
	            	var myMask = new Ext.LoadMask(kakakuPricePanel, {msg:"Please wait..."});
	            	myMask.show();
					Ext.Ajax.request({
					    url: 'doGetCsv/',
					    params:{
							u64:kakakuPricePanel.down("#u64").getValue(),
							u32:kakakuPricePanel.down("#u32").getValue(),
							p64:kakakuPricePanel.down("#p64").getValue(),
							p32:kakakuPricePanel.down("#p32").getValue()
						},
					    success: function(response, opts) {
//							if(response.responseText){
//								var result = response.responseText;
//								var result = response.responseText.split(",");
//								kakakuPricePanel.down("#message").setValue(result[0]);
//								kakakuPricePanel.down("#password").setValue(result[1]);
//								kakakuPricePanel.down("#createTime").setValue(result[2]);
//								myMask.hide();
//							}
					    },
					    failure: function(response, opts) {
					    	kakakuPricePanel.down("#password").setValue("作成失敗");
					        console.log('server-side failure with status code ' + response.status);
					        myMask.hide();
					    }
					});
	            	}
	            }]
			}]
		});


	});
